package com.collect.senegal.zhiBean.zhiReceive;

import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;

import com.collect.senegal.MyApplication;
import com.collect.senegal.R;
import com.collect.senegal.zhiGlobal.zhiAppSettings.ZHIProjectConstants;
import com.collect.senegal.zhiUtils.StringUtil;

import java.io.Serializable;
import java.util.ArrayList;

public class ZHIRCustomerRepayOrderListEntity implements Serializable {
    private String repayTime;
    private String orderId;
    private String userId;
    private String mobile;
    private String repayAmount;
    private String fullName;
    private String product;
    private String smsContent;
    private String whatsAppContent;
    private String followNum;

    private String virtualBankAccount;
    private String virtualBankName;
    //kt
    private String repayUrl;

    private String partRepayAmount;
    private String remainRepayAmount;
    private String contactResult;
    private String remark;
    private String settleFlag;

    private ArrayList<String> mobileList;

    public String getRepayTime() {
        return repayTime;
    }

    public void setRepayTime(String repayTime) {
        this.repayTime = repayTime;
    }

    public String getOrderId() {
        return StringUtil.safeString(orderId);
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getMobile() {
        return StringUtil.safeString(mobile);
    }

    public String getMobileEncryptFormatter() {
        return StringUtil.phoneNumberEncryptFormatter(getMobile());
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getRepayAmount() {
        return StringUtil.safeString(repayAmount);
    }

    public String getRepayAmountFormat() {
        return StringUtil.numberTothousandFormatter(getRepayAmount()) + ZHIProjectConstants.RS_FLAG;
    }

    public void setRepayAmount(String repayAmount) {
        this.repayAmount = repayAmount;
    }

    public String getFullName() {
        return StringUtil.safeString(fullName);
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getProduct() {
        return StringUtil.safeString(product);
    }

    public void setProduct(String product) {
        this.product = product;
    }

    public String getSmsContent() {
        return StringUtil.safeString(smsContent);
    }

    public void setSmsContent(String smsContent) {
        this.smsContent = smsContent;
    }

    public String getWhatsAppContent() {
        return StringUtil.safeString(whatsAppContent);
    }

    public void setWhatsAppContent(String whatsAppContent) {
        this.whatsAppContent = whatsAppContent;
    }

    public String getFollowNum() {
        return StringUtil.safeString(followNum);
    }

    public int getFollowNumInt() {
        try {
            String flownum = getFollowNum();
            if (!TextUtils.isEmpty(flownum)) {
                return Integer.parseInt(flownum);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }

    public void setFollowNum(String followNum) {
        this.followNum = followNum;
    }

    public String getVirtualBankAccount() {
        return StringUtil.safeString(virtualBankAccount);
    }

    public void setVirtualBankAccount(String virtualBankAccount) {
        this.virtualBankAccount = virtualBankAccount;
    }

    public String getVirtualBankName() {
        return StringUtil.safeString(virtualBankName);
    }

    public void setVirtualBankName(String virtualBankName) {
        this.virtualBankName = virtualBankName;
    }

    public boolean isValidVirtualBankAccount() {
        if (TextUtils.isEmpty(getVirtualBankAccount())) {
            return false;
        }
        return !TextUtils.isEmpty(getVirtualBankName());
    }

    public String getPartRepayAmount() {
        return StringUtil.safeString(partRepayAmount);
    }

    public String getPartRepayAmountFormat() {
        return StringUtil.numberTothousandFormatter(getPartRepayAmount()) + ZHIProjectConstants.RS_FLAG;
    }

    public void setPartRepayAmount(String partRepayAmount) {
        this.partRepayAmount = partRepayAmount;
    }

    public String getRemainRepayAmount() {
        return StringUtil.safeString(remainRepayAmount);
    }

    public void setRemainRepayAmount(String remainRepayAmount) {
        this.remainRepayAmount = remainRepayAmount;
    }

    public String getRemainRepayAmountFormat() {
        return StringUtil.numberTothousandFormatter(getRemainRepayAmount()) + ZHIProjectConstants.RS_FLAG;
    }

    public String getContactResult() {
        return StringUtil.safeString(contactResult);
    }

    public void setContactResult(String contactResult) {
        this.contactResult = contactResult;
    }

    public String getRemark() {
        return StringUtil.safeString(remark);
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public SpannableStringBuilder getRemarkSpanFormat() {

        String line0 = MyApplication.getAppContext().getString(R.string.remark_flag);
        String line1 = getRemark();
        String fullLine = line0 + line1;

        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(fullLine);
        spannableStringBuilder.setSpan(new ForegroundColorSpan(MyApplication.getAppContext().getResources().getColor(R.color.theme_black_2)), 0, line0.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        spannableStringBuilder.setSpan(new ForegroundColorSpan(MyApplication.getAppContext().getResources().getColor(R.color.theme_color_0)), line0.length(), fullLine.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);

        spannableStringBuilder.setSpan(new AbsoluteSizeSpan(12, true), 0, line0.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
        spannableStringBuilder.setSpan(new AbsoluteSizeSpan(14, true), line0.length(), fullLine.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);

        return spannableStringBuilder;
    }

    public String getSettleFlag() {
        return StringUtil.safeString(settleFlag);
    }

    public boolean isSettleFlag() {
        return getSettleFlag().equalsIgnoreCase("YES");
    }

    public void setSettleFlag(String settleFlag) {
        this.settleFlag = settleFlag;
    }

    public boolean isValidRepayUrl() {
        return !TextUtils.isEmpty(getRepayUrl());
    }

    public String getRepayUrl() {
        return StringUtil.safeString(repayUrl);
    }

    public void setRepayUrl(String repayUrl) {
        this.repayUrl = repayUrl;
    }

    public String getUserId() {
        return StringUtil.safeString(userId);
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public ArrayList<String> getMobileList() {
        if (mobileList == null) {
            mobileList = new ArrayList<>();
        }
        return mobileList;
    }

    public void setMobileList(ArrayList<String> mobileList) {
        this.mobileList = mobileList;
    }
}
